package chixing.day14.homework.work2;

import java.util.HashMap;

public class Count {
    public static void main(String[] args) {
        HashMap<Character,Integer> charMap = new HashMap<>();
        String s1 = "hello world";
        char[] charArray = s1.toCharArray();
        for (int i = 0;i<charArray.length;i++){
            int count = 0;
            for (int j =0;j<charArray.length;j++){
                if (charArray[i]==charArray[j]){
                    count++;
                }
            }
            charMap.put(charArray[i],count);
        }
        charMap.forEach((key, value) -> System.out.println(key +"->"+  value));
    }
}
